const mongoose = require('mongoose')
const Content = require('../../model/content')


module.exports = async (req, res) => {
    var { id } = req.params
    var {content} = req.fields
    try {
       var data = await Content.create({
        article:id,content,status:true
       })
    }
    catch (err) {
        console.log(err);
        return res.send({
            data: null,
            meta: {
                status: 401,
                msg: '添加失败'
            }
        })
    }
    res.send({
        data,
        meta: {
            status: 201,
            msg: '添加成功'
        }
    })
}
